# 特征提取



import cv2
import numpy as np

# 读取图像
image = cv2.imread('./static/1.jpg')
image = cv2.resize(image, (500,500))

# 转换为灰度图像
gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)

# 创建SIFT特征提取器
sift = cv2.SIFT_create()

# 检测图像中的关键点和描述符
keypoints, descriptors = sift.detectAndCompute(gray_image, None)
# 绘制关键点
image_with_keypoints = cv2.drawKeypoints(image, keypoints, None)

# 显示原始图像和带有关键点的图像
cv2.imshow('Original Image', image)
cv2.imshow('Image with Keypoints', image_with_keypoints)
cv2.waitKey(0)
cv2.destroyAllWindows()
